class Node{
    public Object item;
    public Node next;
    public Node prev;

    public Node(Object item) {
        this.item = item;
    }

    @Override
    public String toString() {
        return item + "";
    }
}
public class LinkListTest {
    public static void main(String[] args) {
        Node a = new Node("aaa");
        Node b = new Node("bbb");
        Node c = new Node("ccc");

        a.next = b;
        b.next = c;
        c.prev = b;
        b.prev = a;

        Node frist = a;
        Node last = c;

        while (true){
            if (frist == null){
                break;
            }
            System.out.print(frist + "  ");
            frist = frist.next;
        }

        System.out.println();
        System.out.println("=================");

        Node S = new Node("SSS");
        b.next = S;
        S.next = c;
        frist = a;
        while (true){
            if (frist == null){
                break;
            }
            System.out.print(frist + "  ");
            frist = frist.next;
        }
    }
}
